function show_edit() {
//store	
	var formStore1 = new Ext.data.Store( [ 'bianhao_update', 'bianma_update',
			'mingcheng_update', 'fenlei_update', 'hanyi_update',
			'miaoshu_update', 'jingdu_update', 'danwei_update', 'bumen_update',
			'laiyuan', 'koujing', 'zhouqi', "zhibiaozhi_update", "juhe_update",
			'keyong_update' ]);


//fenlei begin	
	var nodeid;
	var selectedNode = null;
	var comb_fenlei = new Ext.form.ComboBox(
			{
				id : 'fenlei_update',
				store : new Ext.data.SimpleStore( {
					fields : [],
					data : [ [] ]
				}),
				editable : false,
				fieldLabel : '所属分类',
				shadow : false,
				mode : 'local',
				emptyText : '请选择所属分类',
				anchor : '70%',
				triggerAction : 'all',
				tpl : '<tpl for="."><div style="height:200px"><div id="tree_fenlei_up"></div></div></tpl>',
				selectedClass : '',
				onSelect : Ext.emptyFn
			});

	var tree_root_up = new Ext.tree.AsyncTreeNode( {
		text : '分类',
		id : 0000
	});

	var tree_up = new Ext.tree.TreePanel(
			{
				border : '0',
				height : 200,
				useArrows : true,
				autoScroll : true,
				animate : true,
				enableDD : false,
				containerScroll : true,
				rootVisible : false,
				root : tree_root_up,
				autoScroll : true,

				lines : false,
				iconCls : 'nav',
				checkModel : 'cascade',
				onlyLeafCheckable : false,
				titleCollapse : true,
				listeners : {
					beforeload : function(node) {
						var openUrl = basePath + 'JarpListener?className=cn.com.jsepc.rep.catalog.CatalogDAO&methodName=getCatalog&paramCount=0'
						node.loader = new Ext.tree.TreeLoader( {
							dataUrl : openUrl
						});
					}
				}
			});

	tree_up.on('click', function(node) {
		selectedNode = node;
		Ext.ComponentMgr.get("fenlei_update_hidden").setValue(node.id);
		var nodename = node.text;
		Ext.getCmp("fenlei_update").setValue(nodename);
		selectedNode = null;
		comb_fenlei.canCollapse = true; 
		comb_fenlei.collapse();
	});

	comb_fenlei.on('expand', function() {
		tree_up.render('tree_fenlei_up');
	});
	tree_up.on('expandnode', function() { comb_fenlei.canCollapse = true; });
	tree_up.on('beforeload', function() { comb_fenlei.canCollapse = false; });
	tree_up.on('beforeexpandnode', function() { comb_fenlei.canCollapse = false; });
	tree_up.on('beforecollapsenode', function() { comb_fenlei.canCollapse = false; });

	comb_fenlei.on('expand', function () {
		comb_fenlei.canCollapse = true;
            if (tree_up) {
            	comb_fenlei.canCollapse = true;          
            	tree_up.getRootNode().expand();
                
            }
      });
	comb_fenlei.on('collapse', function() {
            if (!comb_fenlei.canCollapse) {
            	comb_fenlei.expand();
            }
        });	
//fenlei end	
	
	
	
//	dept_up_ begin
	var selectedNode_dept_up = null;
	var comb_dept_up = new Ext.form.ComboBox(
			{
				id : 'dept_update',
				store : new Ext.data.SimpleStore( {
					fields : [],
					data : [ [] ]
				}),
				editable : false,
				fieldLabel : '归口部门',
				shadow : false,
				mode : 'local',
				emptyText : '请选择归口部门',
				anchor : '70%',
				triggerAction : 'all',
				tpl : '<tpl for="."><div style="height:200px"><div id="tree_dept_up"></div></div></tpl>',
				selectedClass : '',
				onSelect : Ext.emptyFn
			});
	
	var tree_root_dept_up = new Ext.tree.AsyncTreeNode( {
		text : '部门',
		id : -1
	});

	var tree_dept_up = new Ext.tree.TreePanel(
			{
				border : '0',
				height : 200,
				useArrows : true,
				autoScroll : true,
				animate : true,
				enableDD : false,
				containerScroll : true,
				rootVisible : false,
				root : tree_root_dept_up,
				autoScroll : true,
				lines : false,
				iconCls : 'nav',
				checkModel : 'cascade',
				onlyLeafCheckable : false,
				titleCollapse : true,
				listeners : {
					beforeload : function(node) {
						var openUrl_up = basePath + 'JarpListener?className=cn.com.jsepc.rep.report.CorpDeptTree&methodName=getCorpDeptTreeData&paramCount=2';
						openUrl_up += '&param_0='+node.id+'&param_1=';
						node.loader = new Ext.tree.TreeLoader( {
							dataUrl : openUrl_up
						});
					}
				}
			});

	tree_dept_up.on('click', function(node) {
		selectedNode_dept_up = node;
		nodeid = node.id;
		var nodename = node.text;
		Ext.ComponentMgr.get("dept_update").setValue(nodename);
	    Ext.ComponentMgr.get("bumen_update").setValue(nodeid);		
		selectedNode_dept_up = null;
		comb_dept_up.canCollapse = true;
		comb_dept_up.collapse();
	});

	comb_dept_up.on('expand', function() {
		tree_dept_up.render('tree_dept_up');
	});
	
	tree_dept_up.on('expandnode', function() { comb_dept_up.canCollapse = true; });
	tree_dept_up.on('beforeload', function() { comb_dept_up.canCollapse = false; });
	tree_dept_up.on('beforeexpandnode', function() { comb_dept_up.canCollapse = false; });
	tree_dept_up.on('beforecollapsenode', function() { comb_dept_up.canCollapse = false; });

	comb_dept_up.on('expand', function () {
		comb_dept_up.canCollapse = true;
            if (tree_dept_up) {
            	comb_dept_up.canCollapse = true;          
                tree_dept_up.getRootNode().expand();
                
            }
      });
	comb_dept_up.on('collapse', function() {
            if (!comb_dept_up.canCollapse) {
            	comb_dept_up.expand();
            }
        });	
//	dept_up end

	
	
//*****************************更新窗口****************************//	
	var re = Ext.ComponentMgr.get("ggg").getSelectionModel().getSelected();
	if (re == null || re == "") {
		Ext.Msg.alert('提示', '请选择需要修改的指标数据！');
	  } else {
			var win_update = new Ext.Window( {
				title : '指标信息维护',
				layout : 'fit',
				width : 420,
				height : 505,
				closeAction : 'close',
			    modal:true,
				plain : true,
				layout : "border",
				tbar : [ {
					text : "保存",
					handler : function() {
						saveForm_up();
					}
				}, {
					text : "关闭",
					handler : function() {
						win_update.close();
					}
				} ],

				items : new Ext.FormPanel( {
					labelWidth : 100,
					labelAlign : "left",
					layout : "form",
					region : "center",
					frame : true,
					items : [
							{
								xtype : "hidden",
								fieldLabel : "指标编号",
								disabled : true,
								id : 'bianhao_update',
								anchor : "70%",
								dataIndex : 'record_bianma'
							},
							{
								xtype : "textfield",
								fieldLabel : "指标编码",
								id : 'bianma_update',
								anchor : "70%",
								emptyText : '字母或下划线开头',
								regex : /^[A-Za-z_]+[A-Za-z0-9_]*$/
							},
							{
								xtype : "textfield",
								fieldLabel : "指标名称",
								anchor : "70%",
								id : 'mingcheng_update'
							},
							[ comb_fenlei ],
							{
								xtype : "hidden",
								fieldLabel : "所属分类",
								anchor : "80%",
								id : 'fenlei_update_hidden'
							},
							{
								xtype : "textarea",
								fieldLabel : "指标含义(最多可填350汉字)",
								anchor : "85%",
								id : 'hanyi_update'
							},
							{
								xtype : "textarea",
								fieldLabel : "算法描述(最多可填500汉字)",
								anchor : "85%",
								id : 'miaoshu_update'
							},
							{
								xtype : "numberfield",
								fieldLabel : "数据精度",
								emptyText : '请填写数字(不超过9)',
								blankText : '此项必选',
								regex :/^[0-9]$/,
								anchor : "70%",
								id : 'jingdu_update'
							},
							{
								xtype : "textfield",
								fieldLabel : "数据单位",
								anchor : "70%",
								id : 'danwei_update'
							},
							[ comb_dept_up ],
							{
								xtype : "hidden",
								fieldLabel : "归口部门",
								anchor : "70%",
								id : 'bumen_update'
							},
							new Ext.form.ComboBox( {
								fieldLabel : "数据来源类型",
								anchor : "70%",
								emptyText : '请选择数据来源类型',
								id : 'laiyuan_update',
								triggerAction : 'all',
								store : [ [ '1', '自动抽取' ], [ '2', '手工填报' ] ],
								mode : 'remote',
								valueField : 'value',
								displayField : 'text'
							}),{
								xtype:'hidden',
								id : 'koujing_update'
							},
//							new Ext.form.ComboBox( {
//								hidden:true,
//								fieldLabel : "数据口径",
//								anchor : "70%",
//								emptyText : '请选择数据口径',
//								blankText : '此项必选',
//								id : 'koujing_update',
//								editable : false,
//								triggerAction : 'all',
//								store : [ [ '1', '全口径' ], [ '2', '国网' ],
//										[ '3', '省网' ], [ '4', '上报国网' ],
//										[ '5', '统调口径' ] ],
//								mode : 'remote',
//								valueField : 'value',
//								displayField : 'text'
//							}),
							new Ext.form.ComboBox( {
								fieldLabel : "更新周期",
								anchor : "70%",
								emptyText : '请选择数据周期',
								blankText : '此项必选',
								id : 'zhouqi_update',
								editable : false,
								triggerAction : 'all',
								store : [ [ '1', '年' ], [ '2', '季' ],
										[ '3', '月' ], [ '4', '日' ],
										[ '5', '时' ], [ '6', '分' ] ],
								mode : 'remote',
								valueField : 'value',
								displayField : 'text'
							}), {
								xtype : "hidden",
								fieldLabel : "关联事实表",
								anchor : "70%",
								disabled : true,
								id : 'shishibiao_update'
							}, {
								xtype : "hidden",
								fieldLabel : "指标值字段",
								anchor : "70%",
								disabled : true,
								emptyText : '字母或下划线开头',
								blankText : '此项必填',
								regex : /^[A-Za-z_]+[A-Za-z0-9_]*$/,
								id : 'zhibiaozhi_update'
							}, new Ext.form.ComboBox( {
								fieldLabel : "是否聚合",
								anchor : "70%",
								emptyText : '请选择(必选项)',
								blankText : '此项必选',
								id : 'juhe_update',
								editable : false,
								triggerAction : 'all',
								store : [ [ '1', '可聚合' ], [ '0', '不可聚合' ] ],
								mode : 'remote',
								valueField : 'value',
								displayField : 'text'
							}), new Ext.form.ComboBox( {
								fieldLabel : "是否可用",
								anchor : "70%",
								emptyText : '请选择(必选项)',
								blankText : '此项必选',
								id : 'keyong_update',
								editable : false,
								triggerAction : 'all',
								store : [ [ '1', '可用' ], [ '0', '不可用' ] ],
								mode : 'remote',
								valueField : 'value',
								displayField : 'text'
							}) ]
				})
			})
		win_update.show(this);
//==========================================================================//
			
//把选中的数据加载到窗体相对应的表单中			
		Ext.ComponentMgr.get("bianhao_update").setValue(re.data.repid);
		Ext.ComponentMgr.get("bianma_update").setValue(re.data.repcode);
		Ext.ComponentMgr.get("mingcheng_update").setValue(re.data.repname);
		Ext.ComponentMgr.get("fenlei_update").setValue(re.data.cataname);
		Ext.ComponentMgr.get("fenlei_update_hidden").setValue(re.data.cataid);
		Ext.ComponentMgr.get("hanyi_update").setValue(re.data.repdesc);
		Ext.ComponentMgr.get("miaoshu_update").setValue(re.data.desc);
		Ext.ComponentMgr.get("jingdu_update").setValue(re.data.dataprec);
		Ext.ComponentMgr.get("danwei_update").setValue(re.data.dataunit);
		Ext.ComponentMgr.get("bumen_update").setValue(re.data.departmentid);
		Ext.ComponentMgr.get("dept_update").setValue(re.data.department);
			var laiyuan_up = re.data.sourcetype;
			if (laiyuan_up == 1) {
		Ext.ComponentMgr.get("laiyuan_update").setValue("自动抽取");
			} else {
		Ext.ComponentMgr.get("laiyuan_update").setValue("手工填报");
			}
		Ext.ComponentMgr.get("koujing_update").setValue(re.data.datatype)
//		var koujing_up = re.data.datatype;
//		if (koujing_up == 1) {
//			Ext.ComponentMgr.get("koujing_update").setValue("全口径");
//		} else if (koujing_up == 2) {
//			Ext.ComponentMgr.get("koujing_update").setValue("国网");
//		} else if (koujing_up == 3) {
//			Ext.ComponentMgr.get("koujing_update").setValue("省网");
//		} else if (koujing_up == 4) {
//			Ext.ComponentMgr.get("koujing_update").setValue("上报国网");
//		} else if (koujing_up == 5) {
//			Ext.ComponentMgr.get("koujing_update").setValue("统调口径");
//		}
			var zhouqi_up = re.data.updatetime;
			if (zhouqi_up == 1) {
		Ext.ComponentMgr.get("zhouqi_update").setValue("年");
			} else if (zhouqi_up == 2) {
		Ext.ComponentMgr.get("zhouqi_update").setValue("季");
			} else if (zhouqi_up == 3) {
		Ext.ComponentMgr.get("zhouqi_update").setValue("月");
			} else if (zhouqi_up == 4) {
		Ext.ComponentMgr.get("zhouqi_update").setValue("日");
			} else if (zhouqi_up == 5) {
		Ext.ComponentMgr.get("zhouqi_update").setValue("时");
			} else if (zhouqi_up == 6) {
		Ext.ComponentMgr.get("zhouqi_update").setValue("分");
			}
		Ext.ComponentMgr.get("shishibiao_update").setValue(re.data.reffact);
		Ext.ComponentMgr.get("zhibiaozhi_update").setValue(re.data.repvaluecol);
			var juhe_up = re.data.issum;
			if (juhe_up == 1) {
		Ext.ComponentMgr.get("juhe_update").setValue("可聚合");
			} else if (juhe_up == 0) {
		Ext.ComponentMgr.get("juhe_update").setValue("不可聚合");
			}
			var keyong_up = re.data.isvalid;
			if (keyong_up == 1) {
		Ext.ComponentMgr.get("keyong_update").setValue("可用");
			} else if (keyong_up == 0) {
		Ext.ComponentMgr.get("keyong_update").setValue("不可用");
			}
	}
//=================================================================//
	
	function saveForm_up() {
		formStore1.bianhao_update = Ext.ComponentMgr.get("bianhao_update").getValue();
		formStore1.bianma_update = Ext.ComponentMgr.get("bianma_update").getValue();
		formStore1.mingcheng_update = Ext.ComponentMgr.get("mingcheng_update").getValue();
		formStore1.fenlei_update = Ext.ComponentMgr.get("fenlei_update_hidden").getValue();
		formStore1.hanyi_update = Ext.ComponentMgr.get("hanyi_update").getValue();
		// Ext.ComponentMgr.get("fenlei_update").getValue();
		formStore1.miaoshu_update = Ext.ComponentMgr.get("miaoshu_update").getValue();
		formStore1.jingdu_update = Ext.ComponentMgr.get("jingdu_update").getValue();
		formStore1.danwei_update = Ext.ComponentMgr.get("danwei_update").getValue();
		formStore1.bumen_update = Ext.ComponentMgr.get("bumen_update").getValue();
			var laiyuan_upt = Ext.ComponentMgr.get("laiyuan_update").getValue();
			if (laiyuan_upt == "自动抽取" || laiyuan_upt == "1") {
		formStore1.laiyuan_update = "1";
			} else if (laiyuan_upt == "手工填报" || laiyuan_upt == "2") {
		formStore1.laiyuan_update = "2";
			}
		formStore1.koujing_update = Ext.ComponentMgr.get("koujing_update").getValue();
//			if (koujing_upt == "全口径" || koujing_upt == "1") {
//		formStore1.koujing_update = "1";
//			} else if (koujing_upt == "国网" || koujing_upt == "2") {
//		formStore1.koujing_update = "2";
//			} else if (koujing_upt == "省网" || koujing_upt == "3") {
//		formStore1.koujing_update = "3";
//			} else if (koujing_upt == "上报国网" || koujing_upt == "4") {
//		formStore1.koujing_update = "4";
//			} else if (koujing_upt == "统调口径" || koujing_upt == "5") {
//		formStore1.koujing_update = "5";
//			}
			var zhouqi_upt = Ext.ComponentMgr.get("zhouqi_update").getValue();
			if (zhouqi_upt == "年" || zhouqi_upt == "1") {
		formStore1.zhouqi_update = "1";
			} else if (zhouqi_upt == "季" || zhouqi_upt == "2") {
		formStore1.zhouqi_update = "2";
			} else if (zhouqi_upt == "月" || zhouqi_upt == "3") {
		formStore1.zhouqi_update = "3";
			} else if (zhouqi_upt == "日" || zhouqi_upt == "4") {
		formStore1.zhouqi_update = "4";
			} else if (zhouqi_upt == "时" || zhouqi_upt == "5") {
		formStore1.zhouqi_update = "5";
			} else if (zhouqi_upt == "分" || zhouqi_upt == "6") {
		formStore1.zhouqi_update = "6";
			}
		formStore1.zhibiaozhi_update = Ext.ComponentMgr.get("zhibiaozhi_update").getValue();
			var juhe_upt = Ext.ComponentMgr.get("juhe_update").getValue();
			if (juhe_upt == "可聚合" || juhe_upt == "1") {
		formStore1.juhe_update = "1";
			} else if (juhe_upt == "不可聚合" || juhe_upt == "0") {
		formStore1.juhe_update = "0";
			}
			var keyong_upt = Ext.ComponentMgr.get("keyong_update").getValue();
			if (keyong_upt == "可用" || keyong_upt == "1") {
		formStore1.keyong_update = "1";
			} else if (keyong_upt == "不可用" || keyong_upt == "0") {
		formStore1.keyong_update = "0";
			}

//输入待传入的url			
		var saveItemInfoUrl = "";
		saveItemInfoUrl = '?className=cn.com.jsepc.rep.report.zhibiao_manage';
		saveItemInfoUrl += '&methodName=updatezhibiao';
		saveItemInfoUrl += '&paramCount=0';

		saveItemInfoUrl = basePath + 'JarpListener' + saveItemInfoUrl;
		
//验证文本框		
		if (formStore1.bianma_update == null || formStore1.bianma_update == "") {
			Ext.Msg.alert('提示', '指标编码不能为空！');
		} else if (isDigit(formStore1.bianma_update)) {
			Ext.Msg.alert('提示', '指标编码只能为大写字母、数字和下划线格式，并且只能以字母和下划线开头！');
		} else if (formStore1.mingcheng_update == null
				|| formStore1.mingcheng_update == "") {
			Ext.Msg.alert('提示', '维度名称不能为空！');
		} else if (formStore1.fenlei_update == null
				|| formStore1.fenlei_update == "") {
			Ext.Msg.alert('提示', '指标所属分类不能为空！');
		}else if ((formStore1.hanyi_update).length > 350) {
			Ext.Msg.alert('提示', '指标含义不能超过350个汉字');
		} else if ((formStore1.miaoshu_update).length > 500) {
			Ext.Msg.alert('提示', '指标描述不能超过500个汉字');
		} else if (formStore1.jingdu_update != 0
				&& (formStore1.jingdu_update == null || formStore1.jingdu_update == "")) {
			Ext.Msg.alert('提示', '指标精度不能为空！');
		} else if (formStore1.jingdu_update > 9) {
			Ext.Msg.alert('提示', '指标精度为正整数0-9！');
		} else if (formStore1.danwei_update == null
				|| formStore1.danwei_update == "") {
			Ext.Msg.alert('提示', '单位不能为空！');
		} else if (formStore1.bumen_update == null
				|| formStore1.bumen_update == "") {
			Ext.Msg.alert('提示', '归口部门不能为空！');
		} else if (formStore1.laiyuan_update == null
				|| formStore1.laiyuan_update == "") {
			Ext.Msg.alert('提示', '来源不能为空！');
		} 
//		else if (formStore1.koujing_update == null
//				|| formStore1.koujing_update == "") {
//			Ext.Msg.alert('提示', '口径类型必选！');
//		} 取消作为纬度
		else if (formStore1.zhouqi_update == null
				|| formStore1.zhouqi_update == "") {
			Ext.Msg.alert('提示', '周期必选！');
		}
//		else if (formStore1.zhibiaozhi_update == null
//				|| formStore1.zhibiaozhi_update == "") {
//			Ext.Msg.alert('提示', '指标值字段必填！');
//		} else if (isDigit(formStore1.zhibiaozhi_update)) {
//			Ext.Msg.alert('提示', '指标值只能为大写字母、数字和下划线格式，并且只能以字母和下划线开头');
//		}
		else if (formStore1.juhe_update == null
				|| formStore1.juhe_update == "") {
			Ext.Msg.alert('提示', '是否聚合必选！');
		} else if (formStore1.keyong_update == null
				|| formStore1.keyong_update == "") {
			Ext.Msg.alert('提示', '是否可用必选！');
		} else {
			httpR_itemInfo = getXMLHttpRequest();
			httpR_itemInfo.open("POST", saveItemInfoUrl, true);
			httpR_itemInfo.send(Ext.util.JSON.encode(formStore1));
			httpR_itemInfo.onreadystatechange = returnItemSave;
		}
	}

	// 判断输入为大写字母、数字和下划线
	function isDigit(s) {
		var patrn = /^[A-Za-z_]+[A-Za-z0-9_]*$/;
		if (patrn.exec(s))
			return false
		return true
	}
	// //判断输入为0-9的正整数
	 function isnumber(s)
	 {
		 var patrn=/^[0-9]$/;
		 if (patrn.exec(s)) return false
		 return true
	 }
	 
	function returnItemSave() {
		if (httpR_itemInfo.readyState == 4) {
			if (httpR_itemInfo.status == 200) {
				ret = httpR_itemInfo.responseText;
				if (ret == 'haven') {
					Ext.MessageBox.show( {
						title : '提 示',
						msg : ' 数据库已存在此编码 ，编码不能重复，请重新修改'
					});
				} else if (ret == 'haven1') {
					Ext.MessageBox.show( {
						title : '提 示',
						msg : ' 数据库已存在此名称 ，名称不能重复，请重新修改'
					});
				} else if (ret == 'ok') {
					win_update.close();
					Ext.Msg.alert('提示', '修改成功！');
					var grid_e = Ext.ComponentMgr.get("ggg");
					grid_e.store.reload();
				} else {
					Ext.MessageBox.show( {
						title : '提 示',
						msg : ' 未知错误,修改失败 ，请重新填写'
					});
					setTimeout("window.location.reload()", 1500);
				}
			}
		}
	}
}
